<div class="panel panel-default panel-full" ng-controller="monitorSchsessionCtrl">
    <!-- Default panel contents -->
    <div class="panel-heading">会话查询</div>
    <div class="panel-body">
        <div class="row">
            <div class="col-lg-3">
                <p class="input-group"  uib-popover="可以输入perl表达式正则"  popover-trigger="mouseenter">
                    <span class="input-group-addon" ><label >客户标志</label></span>
                    <input type="text" class="form-control" ng-model="clientId" placeholder="客户端标志">
                </p>
            </div>

            <div class="col-lg-3">
                <p class="input-group">
                    <span class="input-group-addon"><label>在线状态</label></span>
                    <select ng-model="online" class="form-control">
                        <option value="">全部</option>
                        <option value="1">在线</option>
                        <option value="0">离线</option>
                    </select>
                </p>
            </div>
            <div class="col-lg-3">
                <p class="input-group">
                    <span class="input-group-addon"><label>开始访问时间</label></span>
                    <input  autoClose="true" class="form-control" date-time format="YYYY-MM-DD HH:mm:ss" view="date" maxView="year" minView="minutes"  ng-model="startdate" readonly>
                </p>
            </div>

            <div class="col-lg-3">
                <p class="input-group">
                    <span class="input-group-addon"><label>截止访问时间</label></span>
                    <input  class="form-control"  date-time format="YYYY-MM-DD HH:mm:ss" view="date" maxView="year" minView="minutes"  ng-model="enddate" readonly>
                </p>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <button class="btn btn-success" type="button" ng-click="sch()">
                    查询
                </button>
            </div>

        </div>
        <div class="row">
            <div class="col-lg-12">
                <!-- Table -->

                <table class="table packettable">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>客户端标识</th>
                        <th>服务器</th>
                        <th>连接情况</th>
                        <th>保留信息</th>
                        <th>订阅主题</th>

                        <th>消息数量</th>

                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="session in data track by $index">
                        <td>{{$index+1+count*(currentPage-1)}}</td>
                        <td style="word-break:break-word">{{session.Clientid}}</td>
                        <td nowrap="nowrap">{{session.ServerName}}</td>

                        <td nowrap="nowrap">
                            <ul>
                                <li><label>在线情况：</label>
                                    {{session.Online?'在线':'离线'}}
                                </li>
                                <li><label>网络地址：</label>
                                    {{session.Connectprop.Remoteaddr}}
                                </li>
                                <li><label>创建时间：</label>
                                    {{session.Connectprop.createtime |date:'yyyy-MM-dd HH:mm:ss.sss'}}
                                </li>
                                <li><label>访问时间：</label>
                                    {{session.Connectprop.lastvisitedtime |date:'yyyy-MM-dd HH:mm:ss.sss' }}
                                </li>
                                <li><label>断线时间：</label>
                                    {{session.Distime | date:'yyyy-MM-dd HH:mm:ss.sss'}}
                                </li>
                                <li><label>登陆用户：</label>
                                    {{session.Connectprop.username}}
                                </li>
                            </ul>
                        </td>
                        <td>
                            <ul ng-if="session.Will.Flag">
                                <li>
                                    <lable>主题：</lable>
                                    {{session.Will.Topic}}
                                </li>
                                <li>
                                    <lable>服务质量：</lable>
                                    {{session.Will.Qos}}
                                </li>
                                <li>
                                    <lable>有效载荷：</lable>
                                    {{session.Will.Payload}}
                                </li>
                                <li>
                                    <lable>保留标志：</lable>
                                    {{session.Will.Retain?'是':'否'}}
                                </li>
                            </ul>
                            <span ng-if="!session.Will.Flag">无</span>

                        </td>
                        <td>
                            <ul>
                                <li ng-repeat="(subscribe,qos) in session.Subscribes"><label>主题：</label>{{subscribe}}<b>({{qos}})</b>
                                </li>
                            </ul>
                        </td>
                        <td nowrap="nowrap">
                            <ul>
                                <li>
                                    <lable>离线：</lable>
                                    {{session.OffineMsgs.length}}
                                </li>
                                <li>
                                    <lable>未完成发送：</lable>
                                    {{session.Pub_s_Pub.length}}
                                </li>
                                <li>
                                    <lable>未完成qos2发送：</lable>
                                    {{session.Pub_s_Pid.length}}
                                </li>
                                <li>
                                    <lable>未完成qos2接收：</lable>
                                    {{session.Pub_r_Qos2id.length}}
                                </li>

                            </ul>

                        </td>


                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="panel-footer">

        <uib-pagination
                total-items="totalPage"
                ng-model="currentPage"
                max-size="maxSize"
                class="pagination-sm"
                boundary-links="true"
                previous-text="上页"
                next-text="下页"
                first-text="首页"
                last-text="尾页"
                rotate="false"
                ng-change="pageChanged()"
                num-pages="numPages"></uib-pagination>

    </div>
</div>